/*
 *      Copyright 2008 Oliver Eichner <o.eichner@gmail.com>
 *      
 *      This program is free software; you can redistribute it and/or modify
 *      it under the terms of the GNU General Public License as published by
 *      the Free Software Foundation; either version 3 of the License, or
 *      (at your option) any later version.
 *      
 *      This program is distributed in the hope that it will be useful,
 *      but WITHOUT ANY WARRANTY; without even the implied warranty of
 *      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *      GNU General Public License for more details.
 *      
 *      You should have received a copy of the GNU General Public License
 *      along with this program; if not, write to the Free Software
 *      Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 *      MA 02110-1301, USA.
 */

/**
 * @file mainwindow.h
 * The main window header
 */

#ifndef MAINWINDOW_H
#define	MAINWINDOW_H

#include <gtkmm.h>
#include <string>
#include <gtkmm/container.h>
#include "DeviceTreeView.h"
#include "text.h"


using namespace std;

/**
 * @class TP_main
 * Main Window Class for tableau-parm GUI
 * @author Oliver Eichner
 * @ver 0.2
 */

class PrintFormOperation;


class TP_main : public Gtk::Window {
public:
    TP_main();
    virtual ~TP_main();
protected:

    Gtk::VBox tp_VBox;
    Gtk::ScrolledWindow tp_ScrolledWindow;
    DeviceTreeView tp_DeviceTreeView;

    //statusbar
    unsigned tpg_ContextId;
    Gtk::Statusbar tpg_Statusbar;

    //menu refpointer
    Glib::RefPtr<Gtk::UIManager> m_refUIManager;
    Glib::RefPtr<Gtk::ActionGroup> m_refActionGroup;
    Glib::RefPtr<Gtk::ToggleAction> m_refChoiceBridge, m_refChoiceDevice,
    m_refChoiceVendor, m_refChoiceModel, m_refChoiceSize,
    m_refChoiceWriteblk, m_refChoiceHpa, m_refChoiceDco,
    m_refChoiceSec;


    //Printing-related objects:
    Glib::RefPtr<Gtk::PageSetup> tpg_refPageSetup;
    Glib::RefPtr<Gtk::PrintSettings> tpg_refSettings;

    virtual void on_menu_others();

    virtual void print_or_preview(Gtk::PrintOperationAction print_action);

    //PrintOperation signal handlers.
    //We handle these so can get necessary information to update the UI or print settings.
    //Our derived PrintOperation class also overrides some default signal handlers.
    virtual void on_printoperation_status_changed(const Glib::RefPtr<PrintFormOperation>& operation);

    virtual void on_printoperation_done(Gtk::PrintOperationResult result, const Glib::RefPtr<PrintFormOperation>& operation);

    //Action signal handlers:

    virtual void on_menu_file_page_setup();
    virtual void on_menu_file_print_preview();
    virtual void on_menu_file_print();

    virtual void on_menu_addcomment();
    virtual void on_menu_saveto();
    virtual void on_menu_details();

    virtual void on_menu_choices_bridge();
    virtual void on_menu_choices_device();
    virtual void on_menu_choices_vendor();
    virtual void on_menu_choices_model();
    virtual void on_menu_choices_size();
    virtual void on_menu_choices_writeblk();
    virtual void on_menu_choices_hpa();
    virtual void on_menu_choices_dco();
    virtual void on_menu_choices_sec();
    virtual void attach_widgets_to_table();
    //    virtual void connect_signals();
    virtual bool on_button_press_event(GdkEventButton* event);

    virtual void on_buttonQuit_clicked();
    virtual void on_buttonRefresh_clicked();

};


#endif //MAINWINDOW_H


